.robot-detail {
    display: flex;
    flex-direction: column;
    height: 100vh; /* 固定页面高度为视窗高度 */
    overflow: hidden; /* 防止页面级别的滚动条 */
}

.robot-detail .top-header {
    position: relative;
}

.detail-container {
    flex: 1;
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止容器级别的滚动条 */
    min-height: 0; /* 允许flex子元素收缩 */
}

/* 左侧导航 */


.sidebar-header {
    height: 50px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.main-content {
    display: flex;
    border-radius: 10px;
    overflow: hidden;
    flex: 1;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 0; /* 关键：允许flex容器收缩 */
}

.back-button {
    color: var(--primary-blue);
    font-size: 1.2rem;
    margin-right: 10px;
    text-decoration: none;
}

.robot-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.nav-pills .nav-link {
    color: #495057;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 10px 15px;
    text-align: left;
}

.nav-pills .nav-link.active {
    background-color: var(--primary-blue);
    font-weight: 500;
    color: #fff;
}


/* 新增实时预览布局样式 */
.basic-container {
    display: flex;
    flex: 1;
    height: 100%;
    overflow: hidden; /* 防止容器溢出 */
}

.publish-container {
    display: flex;
    flex: 1;
    height: 100%;
    overflow: hidden; /* 防止容器溢出 */
}

/* 确保所有子区域高度一致 */
.sidebar,
.config-section,
.preview-section {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
    min-height: 0; /* 允许flex子元素收缩 */
    overflow: hidden; /* 防止区域级别的滚动条 */
}

/* 左侧边栏 */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-gray);
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden; /* 防止整体滚动 */
}

/* 侧边栏导航区域可滚动 */
.sidebar .nav {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* 中间配置区域 */
.config-section {
    flex: 1;
    border-right: 1px solid var(--border-gray);
    overflow: hidden; /* 防止整体溢出 */
}

/* 配置区域内容容器 */
.config-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
}

/* 右侧预览区域 */
.preview-section {
    width: 400px;
    flex-shrink: 0;
    overflow: hidden; /* 防止整体溢出 */
}

/* 预览区域内容滚动 */
.preview-section > *:not(.section-title) {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* 基础编排样式 */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    padding: 20px 20px;
    box-sizing: border-box;
    border-bottom: solid 1px #e2e8f0;
    margin: 0;
    flex-shrink: 0; /* 标题区域不收缩 */
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}


.form-check {
    margin-bottom: 0.5rem;
}
.form-switch .form-check-input {
    width: 2.5em;
    height: 1.5em;
}

.dialog-count {
    color: var(--primary-blue);
    font-weight: 600;
    margin-left: 10px;
}

/* 绑定按钮样式 */
.bind-btn {
    width: 100%;
}

/* 自定义滚动条样式 - 只对可滚动的内容区域 */
.config-content::-webkit-scrollbar,
.sidebar .nav::-webkit-scrollbar,
.preview-section > *:not(.section-title)::-webkit-scrollbar {
    width: 6px;
}

.config-content::-webkit-scrollbar-track,
.sidebar .nav::-webkit-scrollbar-track,
.preview-section > *:not(.section-title)::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.config-content::-webkit-scrollbar-thumb,
.sidebar .nav::-webkit-scrollbar-thumb,
.preview-section > *:not(.section-title)::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.config-content::-webkit-scrollbar-thumb:hover,
.sidebar .nav::-webkit-scrollbar-thumb:hover,
.preview-section > *:not(.section-title)::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 确保内容区域有合适的内边距 */
.config-content {
    padding: 20px;
}

/* 侧边栏导航样式优化 */
.sidebar .robot-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0; /* 标题不收缩 */
}

.sidebar .nav-item {
    margin-bottom: 4px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .preview-section {
        width: 350px;
    }
}

@media (max-width: 992px) {
    .basic-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
    
    .config-section {
        height: 400px;
    }
    
    .preview-section {
        width: 100%;
        height: 400px;
    }
}

/* ===== 关键修复：确保三个区域完美对齐 ===== */
.main-content {
    /* 确保没有内边距影响对齐 */
    padding: 0;
    margin: 0;
    /* 确保边框不会影响布局 */
    box-sizing: border-box;
}

.sidebar,
.config-section, 
.preview-section {
    /* 确保所有区域都有相同的盒模型 */
    box-sizing: border-box;
    /* 移除任何可能的外边距 */
    margin: 0;
    /* 确保高度完全一致 */
    min-height: 100%;
    max-height: 100%;
}

/* 修复可能的Tailwind CSS冲突 */
.sidebar * {
    box-sizing: border-box;
}

/* 确保预览区域内容正确滚动 */
.preview-section > *:not(.section-title) {
    flex: 1;
    overflow-y: auto;
    height: 0; /* 强制flex子元素正确计算高度 */
}

/* 确保配置区域内容正确滚动 */
.config-content {
    height: 0; /* 强制flex子元素正确计算高度 */
    min-height: 0; /* 允许收缩 */
}

